package com.ruoyi.exam.service;

import com.ruoyi.exam.http.ExamHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.io.IOException;
import java.util.Date;

@Service
public class ExamApiService {

    @Autowired
    private ExamHttpClient examHttpClient; // 注入你的HttpClient

    /**
     * 生成试卷
     */
    public SseEmitter generateExamPaper(String subject, Long teacherId, Long classId,
                                        Date startTime, Date endTime) {
        return examHttpClient.generateExamPaper(subject, teacherId, classId, startTime, endTime);
    }

    /**
     * 提交学生答案
     */
    public String submitStudentAnswer(Long paperId, Long studentId,
                                      Long questionId, String answer) throws IOException {
        return examHttpClient.submitStudentAnswer(paperId, studentId, questionId, answer);
    }
}
